package com.hj.dapp.business.mainbudget.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hj.dapp.business.mainbudget.mapper.MainBudgetItemMapper;
import com.hj.dapp.business.mainbudget.model.MainBudgetItem;
import com.hj.dapp.business.mainbudget.service.MainBudgetItemService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 胡奥程
 * @version 1.0
 * @date 2024/1/29
 */
@Service
public class MainBudgetItemServiceImpl implements MainBudgetItemService {
    @Autowired
    private MainBudgetItemMapper mainBudgetItemMapper;

    @Override
    public void save(MainBudgetItem mainBudgetItem) {
        mainBudgetItemMapper.insert(mainBudgetItem);
    }

    @Override
    public void deleteRel(Long mainBudgetId) {
        QueryWrapper<MainBudgetItem> wrapper = new QueryWrapper<>();
        wrapper.eq("main_budget_id", mainBudgetId);
        mainBudgetItemMapper.delete(wrapper);
    }
}
